package com.cabinet.base.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;



public class PropertiesFileUtil {
	
	private static Logger logger = Logger.getLogger(PropertiesFileUtil.class);
	public final static String defaultFileName = "/bzw-base";
	private static PropertiesFileUtil config = new PropertiesFileUtil();
	/**
	 * 获取.properties文件key中的值
	 * @param fileName 文件名，如test.properties只传入test
	 * @param key
	 * @return
	 * @throws IOException
	 */
	public static String getValue(String fileName,String key) throws IOException{
		fileName = fileName+".properties";
		InputStream in = config.getClass().getResourceAsStream(fileName);
		//InputStream in = ClassLoader.getSystemResourceAsStream(fileName); 
		Properties prop = new Properties();    
		prop.load(in);
		return prop.getProperty(key);  
	}

}
